<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>订单详情-${setting.name}</title>
    [#include "common/include.ftl"]
    <link rel="styleSheet" href="${base}/resource/css/member.css">
    <link rel="styleSheet" href="${base}/resource/plug/buttons/buttons.css">
    <script src="${base}/resource/js/member.js"></script>
    <script src="${base}/resource/js/order.js"></script>
    <script src="${base}/resource/js/order.module.js"></script>
    <script>
        $(function(){
            [#if order.shipStatus = "send"]
	            ajax({
	            	url	: base + "/order/getDeliveryInfo.jhtml",
	            	data: {
	            		orderNo	: "${order.orderNo}"
	            	},
	            	success	: function(data){
	            		var html = template('delivery-info', {list:data});
	            		$("#orderFollow").append(html);
	            	}
	            });
	        [/#if]
        });
    </script>
</head>
<body class="customer">
[#include "common/header.ftl"]

<div class="crumbs">
    <a>会员中心</a> > <a>交易管理</a> > <a>订单详情</a>
</div>
<div id="member-main">
    [#assign menuNo='myOrder'/]
    [#include "common/member-left.ftl"/]
    <div class="member-right" id="order-detail">
        <div class="right-wrap">
            <div id="order-info">
                <div class="m-box">
                    <div class="mt">
                        <h4 class="title">
                            [#if order.orderStatus = 'waitBuyerPay']
                                等待买家付款
                            [#elseif order.orderStatus = 'waitSellerSendGoods']
                                正在发货
                            [#elseif order.orderStatus = 'waitBuyerConfirmGoods']
                                已发货
                            [#elseif order.orderStatus = 'tradeFinished']
                                交易完成
                            [#elseif order.orderStatus = 'tradeClosed']
                                交易关闭
                            [/#if]
                        </h4>
                        <div class="btn-group">
                        [#assign data = "{orderNo:'${order.orderNo}',status:'${order.orderStatus}'}" /]
                        [#if order.orderStatus = 'waitBuyerPay']
                            <a data="${data}" class="button onlile-payment">在线支付</a>
                            <span>&nbsp;</span>
                            <a data="${data}" class="button  cancel-order" href="javascript:">取消</a>
                        [#elseif order.orderStatus = 'waitSellerSendGoods']
                            [#if !order.hasRefunded ]
                                <span>&nbsp;</span>
                                <a data="${data}" class="button order-refund" href="javascript:">申请退款</a>
                            [#else]
                                <span>&nbsp;</span>
                                <a data="${data}" class="button order-refund-detail" href="javascript:">退款详情</a>
                            [/#if]
                        [#elseif order.orderStatus = 'waitBuyerConfirmGoods']
                            <a data="${data}" class="button wait-buyer-confirm-goods" href="javascript:">确认收货</a>
                        [#elseif order.orderStatus = 'tradeFinished']
                            <a data="${data}" class="button order-comment">我要评价</a>
                            [#if !order.hasRefunded ]
                                <span>&nbsp;</span>
                                <a data="${data}" class="button order-refund" href="javascript:">申请退款</a>
                            [#else]
                                <span>&nbsp;</span>
                                <a data="${data}" class="button order-refund-detail" href="javascript:">退款详情</a>
                            [/#if]
                            <span>&nbsp;</span>
                            <a data="${data}" class="button delete-order" href="javascript:">删除</a>
                        [#elseif order.orderStatus = 'tradeClosed']
                            [#if order.hasRefunded ]
                                <a data="${data}" class="button order-refund-detail" href="javascript:">退换货详情</a>
                            [/#if]
                            <a data="${data}" class="button  delete-order" href="javascript:">删除</a>
                        [/#if]
                        </div>
                    </div>
                    <br>
                    <div class="mc">
                        <table class="order-list">
                            <tr>
                                <th width="150">商品编号</th>
                                <th width="300">商品名称</th>
                                <th width="150">价格</th>
                               [#-- <th width="100">赠送积分</th>--]
                                <th width="150">数量</th>
                                <th>操作</th>
                            </tr>
                            [#if order.items?has_content]
                                [#list order.items as item]
                                <tr>
                                    <td>${(item.productCode)!}</td>
                                    <td><a target="_blank" href="${base}/goods/${item.goodsId}.jhtml">${(item.productName)!}</a></td>
                                    <td>${currency(item.salePrice, true)}</td>
                                  [#--  <td>0</td>--]
                                    <td>${item.quantity}</td>
                                    <td><a href="javascript:;" onclick="addCart('${item.goodsId}', 1)" class="button button-highlight button-large add-cart">加入购物车</a></td>
                                </tr>
                                [/#list]
                            [/#if]
                        </table>
                    </div>
                </div>

                <div class="m-box">
                    <div class="mt">
                        <h4>订单跟踪</h4>
                    </div>
                    <div class="mc" id="orderFollow">
                        [#if orderLogs?has_content]
                        <table class="table-info">
                            <tr>
                                <td width="20%">处理时间</td>
                                <td>处理意见</td>
                            </tr>
                            [#list orderLogs as log]
                            <tr>
                                <td>${log.createDate}</td>
                                <td>${log.logText}</td>
                            </tr>
                            [/#list]
                        </table>
                        [/#if]
                    </div>
                </div>

                <div class="m-box">
                    <div class="mt">
                        <h4>订单信息</h4>
                    </div>
                    <div class="mc">
                        <table class="table-info">
                            <tr>
                                <td width="12%">订单编号</td>
                                <td>${order.orderNo}</td>
                            </tr>
                            <tr>
                                <td>支付方式</td>
                                <td>${message("PayType."+order.payType)}</td>
                            </tr>
                            <tr>
                                <td>配送方式</td>
                                <td>${(order.deliveryMethodName)!}</td>
                            </tr>
                            <tr>
                                <td>下单时间</td>
                                <td>${(order.createDate?datetime)!}</td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="m-box">
                    <div class="mt">
                        <h4>收货人信息</h4>
                    </div>
                    <div class="mc">
                        <table class="table-info">
                            <tr>
                                <td width="12%">收货人姓名</td>
                                <td>${(order.consignee)!}</td>
                            </tr>
                            <tr>
                                <td>地址</td>
                                <td>${order.areaName+order.address}</td>
                            </tr>
                            <tr>
                                <td>手机号码</td>
                                <td>${(order.contact)[0..3]+"***"+(order.contact)[8..10]}</td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="m-box">
                    <div class="mt">
                        <h4>结算信息</h4>
                    </div>
                    <div class="mc">
                        <table class="table-info">
                            <tr>
                                <td width="12%">商品金额</td>
                                <td>
                                    <span>${currency(order.itemTotal)}元 [#--- 优惠金额：0.00元--] + 运费：${currency(order.shipFee,false)!'0.00'}元- 使用余额：${currency(order.deposit,false)!'0.00'}元 = 订单总金额：</span>
                                    <span style="color:red">${currency(order.totalAmount,false)}</span><span>元</span>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="clear"></div>
</div>

<!--配送方式模版-->
<script id="delivery-info" type="text/html">
    {{each list}}
    	<table class="table-info mt10">
    		<tr>
                <td width="20%">物流公司</td>
                <td>货运单号</td>
            </tr>
            <tr>
                <td><a href="">{{$value.name}}</a></td>
                <td>{{$value.nu}}</td>
            </tr>
            <tr>
                <td>物流信息</td>
                <td style="padding-top:10px;padding-bottom: 10px;">
                	{{if $value.success}}
                		{{each $value.data as item i}}
		                    <dl class="kd">
		                        <dt>{{$item.time}}</dt>
		                        <dd>{{$item.context}}</dd>
		                    </dl>
    					{{/each}}
                	{{else}}
                		{{$value.errCode}}
                	{{/if}}
                </td>
            </tr>
        </table>
    {{/each}}
</script>
[#include "common/footer-slidebar-lazyload.ftl"]
</body>
</html>